//
//  TilePieceList.h
//  MapEdit
//
//  Created by Steven Canfield on 16/06/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "ColorPalette.h"
#import "DebugLog.h"

// 8x8 index into color palette
#pragma options align=packed
struct tile_piece_t {
	u_int8_t pixels[8][8];
};
typedef struct tile_piece_t tile_piece_t;

struct tile_piece_tags_t {
	BOOL needsXTranslation;
	BOOL needsYTranslation;
	BOOL needsXReflection;
	BOOL needsYReflection;
	BOOL needsRotateCW;
};
typedef struct tile_piece_tags_t tile_piece_tags_t;


@interface TilePieceList : NSObject {
	tile_piece_t **	_pieces;
	int				_nPieces;
	tile_piece_tags_t **	_piecesInfo;

	
	NSMutableArray *		_piecesBitmapData;
	NSMutableArray *		_flippedPiecesBitmapData;
}
- (id)initWithData:(NSData *)data palette:(ColorPalette *)palette;
- (NSBitmapImageRep * )imageRepFromTilePiece:(tile_piece_t *)piece palette:(ColorPalette *)palette;
- (NSBitmapImageRep *)bitmapForPieceAtIndex:(int)index;
- (NSBitmapImageRep *)flippedBitmapForPieceAtIndex:(int)index;
- (tile_piece_t)pieceAtIndex:(int)index;
- (tile_piece_tags_t *)pieceInfoAtIndex:(int)index;
@end
